//
//  LGTodayJiSiViewController.m
//  ligenyun
//
//  Created by apple on 2018/4/9.
//  Copyright © 2018年 stoneobs@icloud.com. All rights reserved.
//

#import "LGTodayJiSiViewController.h"
#import "LGHomeTableViewCell.h"
#import "LGGongJiDetailViewController.h"
@interface LGTodayJiSiViewController ()

@end

@implementation LGTodayJiSiViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"今日祭祀";
    [self configSubView];
    
    // Do any additional setup after loading the view.
}
#pragma mark --SubView
- (void)configSubView{
    UIView * header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 156)];
    UIImageView * bannerImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 156)];
    bannerImageView.image = [UIImage imageNamed:@"祠堂banner"];
    [header addSubview:bannerImageView];
    self.tableView.tableHeaderView = header;
    
}
#pragma --mark UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 4;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return [LGHomeTableViewCell cellHeight];
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    return 44;
}

- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UIView * view = [TMUtils headerViewWithTitle:@"私人陵园"];
    UIView * view1 = [TMUtils headerViewWithTitle:@"伟人陵园"];
    if (section == 1) {
        return view1;
    }
    return view;
}
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString * reuseIdentifier =  @"cell";
    LGHomeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
    if (!cell) {
        cell = [[LGHomeTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
        
    }

    return cell;
}
#pragma --mark UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
     [self.navigationController pushViewController:[LGGongJiDetailViewController new] animated:YES];
    [self.tableView deselectRowAtIndexPath:indexPath animated:NO];
}

@end
